<?php


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="/js/jquery-1.9.1.min.js"></script>
</head>
<body>
<table align="center" width="1000" cellpadding="0" cellspacing="1" style="border:1px solid #CCC">
  <tr bgcolor="#EEE" height="24">
    <td>接口地址</td>
    <td>method</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td><select id="api_host">
<?php
	foreach($hosts as $host){
?>
      <option value="<?php echo $host?>"><?php echo $host?></option>
<?php
	}
?>
    </select><?php echo $api["url"]?></td>
    <td><?php echo $api["method"]?></td>
  </tr>
</table>
<br>
<table align="center" width="1000" cellpadding="0" cellspacing="1" style="border:1px solid #CCC">
  <form id="requestform" method="<?php echo $api["method"]?>">
  <tr bgcolor="#EEE" height="24">
    <td>参数名</td>
    <td>参数</td>
    <td>必填</td>
    <td>类型</td>
    <td>说明</td>
  </tr>

  <tr bgcolor="#F9F9F9" height="24">
    <td>id</td>
    <td><input name="fid" type="text" value=""/></td>
    <td>是</td>
    <td>int</td>
    <td>渔场ID</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>name</td>
    <td><input name="name" type="text" value="sda"/></td>
    <td>是</td>
    <td>string</td>
    <td>渔场名称</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>address</td>
    <td><input name="address" type="text" value="sdfgs"/></td>
    <td>是</td>
    <td>string</td>
    <td>渔场地址</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>lat</td>
    <td><input name="lat" type="text" value="123.45"/></td>
    <td>是</td>
    <td>float</td>
    <td>纬度</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>lng</td>
    <td><input name="lng" type="text" value="234.56"/></td>
    <td>是</td>
    <td>float</td>
    <td>经度</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>province</td>
    <td><input name="province" type="text" value="1"/></td>
    <td>是</td>
    <td>int</td>
    <td>渔场所在省份(对应初始化城市数据省份id)</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>city</td>
    <td><input name="city" type="text" value="2"/></td>
    <td>是</td>
    <td>int</td>
    <td>渔场所在城市(对应初始化城市数据城市id)</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>district</td>
    <td><input name="district" type="text" value="3"/></td>
    <td>是</td>
    <td>float</td>
    <td>渔场所在县/区(对应初始化数据县/区域id)</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>area</td>
    <td><input name="area" type="text" value="123"/></td>
    <td>是</td>
    <td>number</td>
    <td>占地面积</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>fish_species</td>
    <td><input name="fish_species" type="text" value="1,2"/></td>
    <td>是</td>
    <td>string</td>
    <td>经营的鱼种(对应初始化鱼种数据的ID，用英文半角逗号拼接)</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>owner</td>
    <td><input name="owner" type="text" value="吴越"/></td>
    <td>是</td>
    <td>string</td>
    <td>渔场主姓名</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>mobile</td>
    <td><input name="mobile" type="text" value="158"/></td>
    <td>是</td>
    <td>number</td>
    <td>渔场主联系方式</td>
  </tr>
  
  <tr bgcolor="#F9F9F9" height="24">
    <td colspan="5" align="center"><input type="button" value="提交" onclick="request()"/></td>
  </tr>
  </form>
</table>
<script language="javascript">

var isAuth = <?php echo $api["isAuth"] ? 'true' : 'false'?>;
var api_id = <?php echo $api["id"]?>;
var url = "<?php echo $api["url"]?>";
var method = "<?php echo $api["method"]?>";
	
function request(){
	
	var api_host_obj = $('#api_host');
	
	var $form = $('#requestform');
	
	$form.attr('method', method);

	if(isAuth){
		var api_host = $('<input type="text" name="api_host" value="'+api_host_obj.val()+'"/>');
		$form.append($('<input type="text" name="api_id" value="'+api_id+'"/>'));  
		$form.append(api_host);  
		$form.attr('action', "/FishingField/asyncEdit");
	}else{
		$form.attr('action', api_host.val()+url);
	}
	
	$form.submit();

}


</script>
</body>
</html>